//
//  ViewController.m
//  myhuibao
//
//  Created by lijun on 13-2-4.
//  Copyright (c) 2013年 myhuibao. All rights reserved.
//

#import "RestaurantViewController.h"
#import "RestaurantSearchViewController.h"
#import "ASIHTTPRequest.h"
#import "ASIFormDataRequest.h"
#import "SBJson.h"
#import<QuartzCore/QuartzCore.h>
#import "OMGToast.h"
#import "Config.h"
#import "RequestLoadingView.h"

@interface RestaurantViewController ()

@end

@implementation RestaurantViewController
@synthesize mainView;
@synthesize edtCity;
@synthesize edtArea;
@synthesize edtKeyword;
@synthesize edtCuisine;
@synthesize edtDiscount;
@synthesize edtReiview;
@synthesize btnBack;
@synthesize cityId;
@synthesize reqArea;
@synthesize reqCity;
@synthesize reqCuisine;
@synthesize reqConsume;
//@synthesize options = _options;
//@synthesize areas = _areas;

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    edtKeyword.delegate = self;
    typeId=1;
    [self initDefault];
//    [self getCity];

    [self startRequest];
}

- (void)startRequest
{
    if(!loadingView)
    {
        loadingView = [[RequestLoadingView alloc]
                               initRequestLoadingView:self
                               queueFinishSelector:nil
                               viewFrame:LoadingViewFrame];
    }
    
    [self getArea];
    [self getCuisine];
    [self getCounsume];
    
    [loadingView addRequestToQueue:reqArea];
    [loadingView addRequestToQueue:reqCuisine];
    [loadingView addRequestToQueue:reqConsume];
    
    [loadingView startRequestQueue];
    
}

-(void)viewDidAppear:(BOOL)animated
{
    if ([[Config Instance]getCityId]!=cityId) {
        [self getArea];
    }
}

//- (void)vewDidUnload
//{
//    [self setEdtCity:nil];
//    [super viewDidUnload];
//    // Release any retained subviews of the main view.
//}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title=@"商户搜索";
    }
    return self;
}
//- (IBAction)showCityList:(id)sender {
//    edtCity.userInteractionEnabled=NO;
//    self.edtCity.text = @"test";
//    edtCity.userInteractionEnabled=YES;
//
//}
- (void)initDefault
{
    if(_showback==1)
        btnBack.hidden = NO;
    else
        btnBack.hidden = YES;
    mainView.layer.cornerRadius=3;
    mainView.layer.borderWidth=1;
    mainView.layer.borderColor=LINE_COLOR.CGColor;
    _searchView.layer.cornerRadius=3;
    _searchView.layer.borderWidth=1;
    _searchView.layer.borderColor= TEXTFIELD_COLOR.CGColor;
    [[mainView layer] setShadowOffset:CGSizeMake(1, 1)];
    [[mainView layer] setShadowRadius:1];
    [[mainView layer] setShadowOpacity:1];
    [[mainView layer] setShadowColor:LINE_COLOR.CGColor];
    
    edtCity.text = [[Config Instance]getCity];
    cityId = [[Config Instance]getCityId];
    areaId = 0;
    cuisineId = 0;
    discountId = 0;
    reviewId = 0;
    //[5-6折]--5,[6-7折]--6,[7-8折]--7,[8-9折]--8,[9-10折]--9, --0
    arrayDiscount = [NSMutableArray arrayWithObjects:
                      [NSDictionary dictionaryWithObjectsAndKeys:@"不限",@"text", @"0",@"id",nil],
                      [NSDictionary dictionaryWithObjectsAndKeys:@"5-6折",@"text", @"5",@"id",nil],
                      [NSDictionary dictionaryWithObjectsAndKeys:@"6-7折",@"text", @"6",@"id",nil],
                      [NSDictionary dictionaryWithObjectsAndKeys:@"7-8折",@"text", @"7",@"id",nil],
                      [NSDictionary dictionaryWithObjectsAndKeys:@"8-9折",@"text", @"8",@"id",nil],
                      [NSDictionary dictionaryWithObjectsAndKeys:@"9-10折",@"text", @"9",@"id",nil],
                      nil];
    //[5-4]--5,[4-3]--4,[3-2]--3,[2-1]--2,[无评分]--1, 不限--0 
//    arrayReivew = [[NSArray arrayWithObjects:
//                      [NSDictionary dictionaryWithObjectsAndKeys:@"不限",@"text", @"0",@"id",nil],
//                      [NSDictionary dictionaryWithObjectsAndKeys:@"4-5分",@"text", @"5",@"id",nil],
//                      [NSDictionary dictionaryWithObjectsAndKeys:@"3-4分",@"text", @"4",@"id",nil],
//                      [NSDictionary dictionaryWithObjectsAndKeys:@"2-3分",@"text", @"3",@"id",nil],
//                      [NSDictionary dictionaryWithObjectsAndKeys:@"1-2分",@"text", @"2",@"id",nil],
//                      [NSDictionary dictionaryWithObjectsAndKeys:@"无评分",@"text", @"1",@"id",nil],
//                      nil] retain];
}
- (void) getCuisine
{
    NSURL *url = [NSURL URLWithString:url_cuisineListWithType] ;
    reqCuisine = [ASIHTTPRequest requestWithURL:url];
    [reqCuisine setDidFinishSelector:@selector(finishCuisine:)];
    [reqCuisine setShouldAttemptPersistentConnection:NO];
    reqCuisine.delegate = self;
    isCuisineFinished = false;
    
    if(!loadingView.bFirstRequest)
    {
        [reqCuisine startAsynchronous];
    }

}
- (void)finishCuisine:(ASIHTTPRequest *)request
{
    NSString *jsonStr = [request responseString];
    NSDictionary *dic = [jsonStr JSONValue];
//    arrayCuisine = [dic valueForKey:@"data"];
//    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
//                          @"0",@"cuisineID",@"不限",@"cuisineName",nil];
//    [arrayCuisine insertObject: dict atIndex:0];
    NSMutableArray *data = [dic valueForKey:@"data"];
    arrayCuisineType = [[NSMutableArray alloc]init];
    for (int i=0;i<data.count;i++) {
//        NSDictionary *dic = data[i];
//        NSString *cuisine = [dic valueForKey:@"cuisinesType"];
//        NSString *cuisineCode=[cuisine componentsSeparatedByString:@"-"][0];
//        NSString *cuisineName=[cuisine componentsSeparatedByString:@"-"][1];
        NSDictionary *dic = [data objectAtIndex:i];
        NSString *cuisine = [dic valueForKey:@"cuisinesType"];
        NSString *cuisineCode=[[cuisine componentsSeparatedByString:@"-"] objectAtIndex:0];
        NSString *cuisineName=[[cuisine componentsSeparatedByString:@"-"]objectAtIndex:1];
        
        NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
                              cuisineCode,@"cuisineCode",cuisineName,@"cuisineName",[dic valueForKey:@"cuisinesList"],@"cuisinesList",nil];
        [arrayCuisineType insertObject:dict atIndex:i];
    }
    //默认全部
    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
                          @"0",@"cuisineID",@"全部菜系",@"cuisineName",nil];
    arrayCuisine = [[NSMutableArray alloc]init];
    [arrayCuisine insertObject: dict atIndex:0];
    NSDictionary *all = [NSDictionary dictionaryWithObjectsAndKeys:
                         @"0",@"cuisineCode",@"全部菜系",@"cuisineName",arrayCuisine,@"cuisinesList",nil];
    [arrayCuisineType insertObject: all atIndex:0];
    isCuisineFinished = true;
}
- (void) getCity{
    //异步请求
    NSURL *url = [NSURL URLWithString:url_city];
    reqCity = [ASIHTTPRequest requestWithURL:url];
    [reqCity setDidFinishSelector:@selector(finishCity:)];
    isCityFinished = false;
    [reqCity setShouldAttemptPersistentConnection:NO];
    [reqCity setDelegate: self];
    [reqCity startAsynchronous];
}
- (void) getArea{
    //异步请求
    //    NSDictionary *dic =[arrayCity objectAtIndex:0];
    //    cityId = [[dic valueForKey:@"cityID"] intValue];
    cityId = [[Config Instance] getCityId];
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?cityID=%d",url_areaWithDistrict,cityId]] ;
    reqArea = [ASIHTTPRequest requestWithURL:url];
    [reqArea setDidFinishSelector:@selector(finishArea:)];
    isAreaFinished = false;
    [reqArea setShouldAttemptPersistentConnection:NO];
    [reqArea setDelegate: self];
    if(!loadingView.bFirstRequest)
    {
        [reqArea startAsynchronous];
    }

}
- (void)finishCity:(ASIHTTPRequest *)request
{
    NSString *jsonStr = [request responseString];
    NSDictionary *dic = [jsonStr JSONValue];
    arrayCity = [dic valueForKey:@"data"];
    isCityFinished = true;
}
- (void)finishArea:(ASIHTTPRequest *)request
{
    NSString *jsonStr = [request responseString];
    NSDictionary *dic = [jsonStr JSONValue];
    NSMutableArray *data = [dic valueForKey:@"data"];
    arrayDistrict = [[NSMutableArray alloc]init];
    for (int i=0;i<data.count;i++) {
//        NSDictionary *dic = data[i];
//        NSString *county = [dic valueForKey:@"county"];
//        NSString *countyCode=[county componentsSeparatedByString:@"-"][0];
//        NSString *countyName=[county componentsSeparatedByString:@"-"][1];
        NSDictionary *dic = [data objectAtIndex:i];
        NSString *county = [dic valueForKey:@"county"];
        NSString *countyCode=[[county componentsSeparatedByString:@"-"] objectAtIndex:0];
        NSString *countyName=[[county componentsSeparatedByString:@"-"] objectAtIndex:1];
        

        NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
                             countyCode,@"countyCode",countyName,@"countyName",[dic valueForKey:@"areaList"],@"areaList",nil];
        [arrayDistrict insertObject:dict atIndex:i];
    }
    //默认全部
    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
                          @"0",@"areaID",@"全部商圈",@"areaName",nil];
    arrayArea = [[NSMutableArray alloc]init];
    [arrayArea insertObject: dict atIndex:0];
    NSDictionary *all = [NSDictionary dictionaryWithObjectsAndKeys:
                          @"0",@"countyCode",@"全部商圈",@"countyName",arrayArea,@"areaList",nil];
    [arrayDistrict insertObject: all atIndex:0];
    isAreaFinished = true;
    areaId = 0;
    edtArea.text = @"选择商圈：不限";
    _selectedTypeIndex=0;
    _selectedIndex=0;
}
- (void) getCounsume{
    //异步请求
    NSURL *url = [NSURL URLWithString:url_avgConsumeList];
    reqConsume = [ASIHTTPRequest requestWithURL:url];
    [reqConsume setDidFinishSelector:@selector(finishConsume:)];
    isConsumeFinished = false;
    [reqConsume setShouldAttemptPersistentConnection:NO];
    [reqConsume setDelegate: self];
    
    if(!loadingView.bFirstRequest)
    {
        [reqConsume startAsynchronous];
    }

}
- (void)finishConsume:(ASIHTTPRequest *)request
{
    NSString *jsonStr = [request responseString];
    NSDictionary *dic = [jsonStr JSONValue];
    arrayConsume = [dic valueForKey:@"data"];
    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
                          @"0",@"avgConsumeID",@"不限",@"avgConsume",nil];
    [arrayConsume insertObject: dict atIndex:0];
    isConsumeFinished = true;
}
//- (void) getTables{
//    //异步请求
//    NSURL *url = [NSURL URLWithString:url_city];
//    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
//    
//    [request setDelegate: self];
//    [request startAsynchronous];
//    
//    url = [NSURL URLWithString: url_area];
//    ASIFormDataRequest *drequest = [ASIFormDataRequest requestWithURL:url];
//    [drequest setPostValue:  @"1" forKey:@"cityID"];
//    [drequest setDelegate: self];
//    [drequest startAsynchronous];
//    
//    url = [NSURL URLWithString:url_cuisine] ;
//    request = [ASIHTTPRequest requestWithURL:url];
//    [request setDelegate: self];
//    [request startAsynchronous];
//}
////下面是两个代理函数,当数据请求成功时会调用requestFinished，请求失败时（如网络问题或服务器内部错误）会调用requestFailed
//- (void)requestFinished:(ASIHTTPRequest *)request
//{
//    // Use when fetching text data
//    if([request.url.absoluteString isEqualToString:url_city]){
//        NSString *jsonStr = [request responseString];
//        NSDictionary *dic = [jsonStr JSONValue];
//        arrayCity = [dic valueForKey:@"data"];
//        dic =[arrayCity objectAtIndex:0];
//        cityId = [[dic valueForKey:@"cityID"] intValue];
//    }
//
//    if([request.url.absoluteString isEqualToString:url_area]){
//        NSString *jsonStr = [request responseString];
//        NSDictionary *dic = [jsonStr JSONValue];
//        arrayArea = [dic valueForKey:@"data"];
//        NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
//                @"0",@"areaID",@"不限",@"areaName",nil];
//        [arrayArea insertObject: dict atIndex:0];
//    }
//    if([request.url.absoluteString isEqualToString:url_cuisine]){
//        NSString *jsonStr = [request responseString];
//        NSDictionary *dic = [jsonStr JSONValue];
//        arrayCuisine = [dic valueForKey:@"data"];
////    NSLog(@"%@", arrayCuisine);
//        dic = [NSDictionary dictionaryWithObjectsAndKeys:
//            @"0",@"cuisineID",@"不限",@"cuisineName",nil];
//        [arrayCuisine insertObject: dic atIndex:0];
//    }
//     
//}
- (void)requestFailed:(ASIHTTPRequest *)request
{
    NSError *error = [request error];
    NSLog(@"%@",error);
    if (error.code==net_failure_code) {
        [OMGToast showWithText:net_failure_msg bottomOffset:100];
    }
}
- (IBAction)OnClickType:(id)sender {
    selectIndex=6;
    NSMutableArray *arrayType= [[NSMutableArray alloc] initWithObjects:
                [NSDictionary dictionaryWithObjectsAndKeys:@"餐饮",@"type",nil],
                [NSDictionary dictionaryWithObjectsAndKeys:@"KTV",@"type",nil],
                [NSDictionary dictionaryWithObjectsAndKeys:@"咖啡茶馆",@"type",nil],
                nil];

    LeveyPopListView *lplv = [[LeveyPopListView alloc] initWithTitle:@"请选择类型..." options:arrayType fullHeight:150 ];
    lplv.name = @"type";
    lplv.selectedIndex=typeId-1;
    lplv.delegate = self;
    [lplv showInView:self.view animated:YES];
}

- (IBAction)showCity:(id)sender {
    selectIndex = 1;
    LeveyPopListView *lplv = [[LeveyPopListView alloc] initWithTitle:@"请选择城市..." options:arrayCity fullHeight:72 ];
    lplv.name = @"cityName";
    lplv.delegate = self;
    [lplv showInView:self.view animated:YES];

}

- (IBAction)showArea:(id)sender {
    

    selectIndex = 2;
    //if(_selectedTypeIndex!=0){
//        arrayArea = [arrayDistrict[_selectedTypeIndex] objectForKey:@"areaList"];
    arrayArea = [[arrayDistrict objectAtIndex: _selectedTypeIndex] objectForKey:@"areaList"];

    //}
    LeveyPopListView *lplv = [[LeveyPopListView alloc] initWithTitle:@"请选择商圈" options:arrayArea types:arrayDistrict fullHeight:72];
    lplv.name = @"areaName";
    lplv.typeName = @"countyName";
    lplv.listName = @"areaList";
    lplv.selectedTypeIndex = _selectedTypeIndex;
    lplv.selectedIndex = _selectedIndex;
    lplv.delegate = self;
    [lplv showInView:self.view animated:YES];
    
}

- (IBAction)showCuisine:(id)sender {
    selectIndex = 3;
    LeveyPopListView *lplv = [[LeveyPopListView alloc] initWithTitle:@"请选择菜系" options:arrayCuisine types:arrayCuisineType fullHeight:72];
    lplv.name = @"cuisineName";
    lplv.typeName = @"cuisineName";
    lplv.listName = @"cuisinesList";
    lplv.selectedTypeIndex = _selectedTypeIndex1;
    lplv.selectedIndex = _selectedIndex1;
    lplv.delegate = self;
    [lplv showInView:self.view animated:YES];
}

- (IBAction)showDiscount:(id)sender {
    selectIndex = 4;
    LeveyPopListView *lplv = [[LeveyPopListView alloc] initWithTitle:@"请选择折扣" options:arrayDiscount];
    lplv.name = @"text";
    lplv.selectedIndex = _selectedIndex;
    lplv.selectedIndex = _selectedIndex2;
    lplv.delegate = self;
    [lplv showInView:self.view animated:YES];
}

- (IBAction)showReivew:(id)sender {
    selectIndex = 5;
    LeveyPopListView *lplv = [[LeveyPopListView alloc] initWithTitle:@"请选择人均消费" options:arrayConsume];
    lplv.name = @"avgConsume";
    lplv.selectedIndex = _selectedIndex3;
    lplv.delegate = self;
    [lplv showInView:self.view animated:YES];
}
- (void)viewDidUnload {
    [self setMainView:nil];
    [self setEdtArea:nil];
    [self setEdtKeyword:nil];
    [self setEdtCuisine:nil];
    [self setEdtDiscount:nil];
    [self setEdtReiview:nil];
//    [mainView release];
    mainView = nil;
    [self setBtnBack:nil];
    [self setSearchView:nil];
    [self setViewArea:nil];
    [self setViewCuisine:nil];
    [self setViewDiscount:nil];
    [self setViewConsume:nil];
    [self setViewType:nil];
    [self setEdtType:nil];
    [self setLbGap:nil];
    [super viewDidUnload];
}

#pragma mark - LeveyPopListView delegates
- (void)leveyPopListView:(LeveyPopListView *)popListView didSelectedIndex:(NSInteger)anIndex options:(NSArray *)_options didSelectedTypeIndex:(NSInteger)anTypeIndex
{
        switch (selectIndex) {
        case 1:{
            edtCity.text = [NSString stringWithFormat:@"城市：%@",[[arrayCity objectAtIndex:anIndex] objectForKey:@"cityName"]];
            cityId = [[[arrayCity objectAtIndex:anIndex] objectForKey:@"cityID"] intValue];
            [arrayArea removeAllObjects];
            [self getArea];

//            NSURL *url = [NSURL URLWithString: url_area];
//            ASIFormDataRequest *drequest = [ASIFormDataRequest requestWithURL:url];
//            [drequest setPostValue: [ NSNumber numberWithInt:cityId] forKey:@"cityID"];
//            [drequest setDelegate: self];
//            [drequest startAsynchronous];
//            edtArea.text = @"商圈： 不限";
//            areaId = 0;

            break;
        }
        case 2:{
            _selectedIndex = anIndex;
            _selectedTypeIndex = anTypeIndex;
            arrayArea = [_options copy];
            edtArea.text = [NSString stringWithFormat:@"选择商圈：%@",[[_options objectAtIndex:anIndex] objectForKey:@"areaName"]];
            
            areaId = [[[_options objectAtIndex:anIndex] objectForKey:@"areaID"] intValue];
            break;
        }
        case 3:{
            _selectedIndex1 = anIndex;
            _selectedTypeIndex1 = anTypeIndex;
            arrayCuisine = [_options copy];
            edtCuisine.text = [NSString stringWithFormat:@"选择菜系：%@",[[_options objectAtIndex:anIndex] objectForKey:@"cuisineName"]];
            
            cuisineId = [[[_options objectAtIndex:anIndex] objectForKey:@"cuisineID"] intValue];
            break;
        }
        case 4:{
            _selectedIndex2 = anIndex;
            edtDiscount.text = [NSString stringWithFormat:@"选择折扣：%@",[[arrayDiscount objectAtIndex:anIndex] objectForKey:@"text"]];
            
            discountId = [[[arrayDiscount objectAtIndex:anIndex] objectForKey:@"id"] intValue];
            break;
        }
        case 5:{
            _selectedIndex3 = anIndex;
            edtReiview.text = [NSString stringWithFormat:@"选择人均：%@",[[arrayConsume objectAtIndex:anIndex] objectForKey:@"avgConsume"]];
            
            avgConsumeID = [[[arrayConsume objectAtIndex:anIndex] objectForKey:@"avgConsumeID"] intValue];
            break;
        }
        case 6:
        {
            typeId=anIndex+1;
            if(anIndex==0)
            {
                _edtType.text=@"选择类型：餐饮";
                _ViewCuisine.hidden=NO;
                _ViewConsume.hidden=NO;
                [_ViewArea setFrame:CGRectMake(_ViewArea.frame.origin.x, 135, _ViewArea.frame.size.width, _ViewArea.frame.size.height)];
                 [_ViewCuisine setFrame:CGRectMake(_ViewArea.frame.origin.x, 178, _ViewArea.frame.size.width, _ViewArea.frame.size.height)];
                 [_ViewDiscount setFrame:CGRectMake(_ViewDiscount.frame.origin.x, 222, _ViewDiscount.frame.size.width, _ViewDiscount.frame.size.height)];
                 [_ViewConsume setFrame:CGRectMake(_ViewConsume.frame.origin.x, 269, _ViewConsume.frame.size.width, _ViewConsume.frame.size.height)];
                _lbGap.hidden=NO;
            }
            else
            {
                _edtType.text=anIndex==1?@"选择类型：KTV" :@"选择类型：咖啡茶馆";
                _ViewCuisine.hidden=YES;
                _ViewConsume.hidden=YES;
                [_ViewArea setFrame:CGRectMake(_ViewArea.frame.origin.x, 135, _ViewArea.frame.size.width, _ViewArea.frame.size.height)];
                [_ViewDiscount setFrame:CGRectMake(_ViewDiscount.frame.origin.x, 222-45, _ViewDiscount.frame.size.width, _ViewDiscount.frame.size.height)];
                _lbGap.hidden=YES;
            }
            break;
        }
        default:
            break;
    }

    
}
- (void)leveyPopListViewDidCancel
{
    //edtCity.text = @"You have cancelled";
}

- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
//    if (theTextField == self.textField) {
        [theTextField resignFirstResponder];
//    }
    return YES;
}
-(void)textFieldDidBeginEditing:(UITextField *)textField{
    _searchView.layer.borderColor= TEXTFIELD_HOTCOLOR.CGColor;
}
-(void)textFieldDidEndEditing:(UITextField *)textField
{
    _searchView.layer.borderColor= TEXTFIELD_COLOR.CGColor;
}


- (IBAction)showSearch:(id)sender {
    RestaurantSearchViewController  *view = [[RestaurantSearchViewController alloc] initWithNibName:@"RestaurantSearchViewController" bundle:nil];
    view.cityId = cityId;
    view.areaId = areaId;
    view.cuisineId = cuisineId;
    view.discoutId = discountId;
    view._selectedTypeIndex1 = _selectedTypeIndex1;
    view._selectedTypeIndex = _selectedTypeIndex;
    view._selectedIndex = _selectedIndex;
    view._selectedIndex1 = _selectedIndex1;
    view._selectedIndex2 = _selectedIndex2;
    view._selectedIndex3 = _selectedIndex3;
    view.merchantType=typeId;
//    view.reviewId = reviewId;
    view.avgConsumeID = avgConsumeID;
    view.keyword = [edtKeyword.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    view.arrayArea = arrayArea;
    view.arrayDistrict = arrayDistrict;
    view.arrayCuisineType = arrayCuisineType;
    view.arrayCuisine = arrayCuisine;
    view.arrayConsume = arrayConsume;
    view.hidesBottomBarWhenPushed=YES;
	[self.navigationController pushViewController:view animated:YES];
//	[view release];
}
- (IBAction)doBack:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];

}

@end
